//
//  ZJFQianTaoTableViewCell.m
//  OurTourism
//
//  Created by 张金峰 on 15/11/26.
//  Copyright © 2015年 Devil_Coming. All rights reserved.
//
#define WIDTH self.contentView.frame.size.width
#import "ZJFQianTaoTableViewCell.h"
#import "ZJFguiDeModel.h"
#import "UIImageView+WebCache.h"
#import "Masonry.h"
@interface ZJFQianTaoTableViewCell ()
@property (nonatomic, retain)UIImageView *img;
@property (nonatomic, retain)UILabel *titleLabel;
@property (nonatomic, retain)UILabel *subTitleLabel;
@property (nonatomic, retain)UILabel *descripeLabel;
@property (nonatomic, retain)UIImageView *heihei;
@end
@implementation ZJFQianTaoTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}
- (void)createView
{
    self.img = [[UIImageView alloc]init];
  //  self.img.backgroundColor  = [UIColor orangeColor];
    [self.contentView addSubview:self.img];
    self.img.contentMode = UIViewContentModeScaleAspectFill;
    self.img.clipsToBounds = YES;
    
    
    self.heihei = [[UIImageView alloc] init];
    [self.contentView addSubview:self.heihei];
    
    
    self.titleLabel = [[UILabel alloc]init];
   // self.titleLabel.backgroundColor = [UIColor redColor];
    self.titleLabel.textColor = [UIColor colorWithRed:0.97 green:0.95 blue:0.91 alpha:1];
    self.titleLabel.shadowColor = [UIColor blackColor];
    self.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:22];
    [self.heihei addSubview:self.titleLabel];

    self.subTitleLabel = [[UILabel alloc]init];
  //  self.subTitleLabel.backgroundColor = [UIColor orangeColor];
    self.subTitleLabel.textColor = [UIColor colorWithRed:0.97 green:0.95 blue:0.91 alpha:1];
    self.subTitleLabel.shadowColor = [UIColor blackColor];
   self.subTitleLabel.font = [UIFont fontWithName:@"Helvetica" size:15];
    [self.heihei addSubview:self.subTitleLabel];

}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top).offset(0);
        make.left.mas_equalTo(self.contentView.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(WIDTH - 20, WIDTH / 3 - 10));
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.img.mas_top).offset(60);
        make.left.mas_equalTo(self.img.mas_left).offset(10);
        make.size.mas_equalTo(CGSizeMake(WIDTH - 20, 20));
    }];
    [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20);
        make.left.mas_equalTo(self.titleLabel.mas_left);
        make.size.mas_equalTo(CGSizeMake(WIDTH - 20, 15));
        
   }];
    
    [self.heihei mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top).offset(0);
        make.left.mas_equalTo(self.contentView.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.contentView.frame.size.width, self.contentView.frame.size.height));
    }];

}
- (void)setGuide:(ZJFguiDeModel *)guide
{
    if (_guide != guide) {
        _guide = guide;
    }
    self.titleLabel.text = self.guide.name;
    if (!self.guide.name) {
        self.titleLabel.text = self.guide.title;
    }
    self.subTitleLabel.text = guide.describe;
    NSString *str = [NSString stringWithFormat:@"%@%@%@", guide.picdomain,@"upload/",guide.coverpic];
    [self.img sd_setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"placeHoder"]];
    self.heihei.image = [UIImage imageNamed:@"1111"];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
